/**
 * ReportGear(2011)
 */
package com.reportgear.report.model.cell.value.salary;

import org.dom4j.Element;

import com.reportgear.report.model.cell.value.AbstractCellObject;
import com.reportgear.report.model.cell.value.ModelDesignableValueObjectClassManager;
import com.reportgear.report.model.cell.value.support.CommonSalaryItemObject;

/**
 * 薪酬项目单元格对象(为四川电信定制)
 * 
 * @version 1.0 2011-3-26
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since Report 1.0
 */
public class SalaryItemObject extends AbstractCellObject{
	// 薪酬项目
	private CommonSalaryItemObject item;

	public SalaryItemObject() {
		this.item = new CommonSalaryItemObject();
	}

	@Override
	public String toString() {
		return getItem().getName();
	}

	public void setItem(CommonSalaryItemObject item) {
		this.item = item;
	}

	public CommonSalaryItemObject getItem() {
		return item;
	}

	@Override
	public void read(Element parent) {
		this.item.read(parent.element("item"));
	}

	@Override
	public void write(Element parent) {
		parent.addAttribute("class", ModelDesignableValueObjectClassManager.INSTANCE.getClassKey(this.getClass()));

		Element el = parent.addElement("item");
		this.item.write(el);
	}
}
